﻿
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 将生命值作为自身动画机的trigger
/// </summary>
[RequireComponent(typeof(Animator))]
public class HurtShow : Entity {
    private Animator ani;

	// Use this for initialization
	void Start () {
        ani = GetComponent<Animator>();
#if DEBUG

        if (ani == null)
        {
            Debug.LogError(name + " hurtshow dont find animator");
            return;
        } 
#endif
        OnHpChange += Destruction;
    }
	
	private void Destruction(float value)
    {
       
        ani.SetInteger("hp", (int)value);   
    
    }
}
